package ihm;

import javax.swing.UIManager;

public class GUIManager {
	
	private static GUIManager instance;
	private MainWindow mw;
	private MainTabbedPane mtp;
	
	private GUIManager(){
		
	}
	
	public static void setBestLookAndFeelAvailable(){
		String system_lf = UIManager.getSystemLookAndFeelClassName().toLowerCase();
		if(system_lf.contains("metal")){
			try {
				UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
			}catch (Exception e) {}
		}else{
			try {
				UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
			}catch (Exception e) {}
		}
	}
	
	public static GUIManager getInstance(){
		if(null == instance){
			synchronized (GUIManager.class) {
				if(null == instance){
					instance = new GUIManager();
				}
				
			}
		}
		return instance;
		
	}
	
	public void startInterface(){
		mw = new MainWindow();
		mtp = new MainTabbedPane();
		mw.getContentPane().add(mtp);
		mw.pack();
	}

	public MainTabbedPane getMainTabbedPane(){
		return this.mtp;
	}
	
	public void rePack(){
		mw.pack();
	}
	

}
